import http from '@/utils/http'
import qs from 'qs'

// 获取当前用户收入数
export const getIncomeNum = () => {
	return http.get('g?service=nurseperson&operation=myincomenew');
}

// 获取当前用户的评价数
export const getEvaNum = () => {
	return http.get('p?service=nurseperson&operation=getbubblingnum');
}

// 获取省份
export const getProvinces = () => {
	return http.get(`g?service=doctorperson&operation=provincelist`)
}

// 获取城市
export const getCitys = (provinceid) => {
	return http.get(`g?service=doctorperson&operation=citylist&provinceid=${provinceid}`)
}

// 获取医院列表
export const getHospitals = (cityid) => {
	return http.get(`g?service=doctorperson&operation=hospitallist&cityid=${cityid}`)
}

// 获取一级科室
export const getDeptBig = () => {
	return http.get(`g?service=doctorperson&operation=bigdepartmentlist`)
}

// 获取二级科室
export const getDeptSmall = (id) => {
	return http.get(`g?service=doctorperson&operation=smalldepartmentlist&departmentid=${id}`)
}

// 获取职称列表
export const getJobTitle = () => {
	return http.get(`g?service=doctorperson&operation=jobtitlelist`)
}

// 保存个人资料
export const saveInfos = (params) => {
	return http.post(`p?service=nurseperson&operation=perfectinfo`, params)
}

// 保存用户头像
export const saveAvatar = (params) => {
	return http.post(`p?service=nurseperson&operation=headpic`, params)
}

// 陪诊认证
export const savePeizhenAuth = (params) => {
	return http.post(`p?service=nurseperson&operation=peizhenauthinfo`, params)
}

// 陪护认证
export const savePeihuAuth = (params) => {
	return http.post(`p?service=nurseperson&operation=submitChaperonageInfo`, params)
}

// 获取陪诊信息
export const getPeizhenAuth = () => {
	return http.get(`p?service=nurseperson&operation=nurseauthinfo`)
}
// 获取陪护信息
export const getPeihuAuth = () => {
	return http.get(`g?service=nurseperson&operation=nurseChaperonageInfo`)
}

// 获取用户的银行和支付宝信息
export const getBankAndAlipayInfo = () => {
	return http.get(`p?service=nurseperson&operation=bankAndAlipayInfo`)
}

// 保存银行s账户
export const saveBankInfo = (params) => {
	return http.get(`p?service=nurseperson&operation=updatebankinfo`, params)
}

// 保存支付宝账户
export const saveAlipayInfo = (params) => {
	return http.get(
		`p?service=nurseperson&operation=updatealipayinfo&alipayName=${params.alipayName}&alipayCardNumber=${params.alipayCardNumber}`,
		params)
}

// 删除支付宝账户
export const delAlipayInfo = () => {
	return http.post(`p?service=nurseperson&operation=deletealipay`)
}

// 删除银行账户
export const delBankInfo = () => {
	return http.get(`p?service=nurseperson&operation=deletebank`)
}

// 获取银行列表
export const getBankList = () => {
	return http.get(`g?service=doctorperson&operation=banklist`)
}

// 获取最新的收入数据
export const getNewIncomeInfo = () => {
	return http.get(`g?service=nurseperson&operation=myincomenew`)
}

// 累计收入明细
export const getIncomeList = (params) => {
	return http.get(`g?service=nurseperson&operation=myIncomeList`, params)
}

// 累计提现明细
export const getWithdrawalList = (params) => {
	return http.get(`g?service=nurseperson&operation=myDrawingsList`, params)
}

// 可提现列表
export const getCanWithdrawalList = () => {
	return http.get(`g?service=nurseperson&operation=canDrawingsOrderList`)
}

// 提现
export const withdrawalMoney = (params) => {
	return http.post(`p?service=nurseperson&operation=drawings&${qs.stringify(params)}`, {}, {
		"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
	})
}
